package com.commons.interceptor.configuration;

import com.commons.interceptor.PermsInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

//将拦截器加入到拦截器组中
@Configuration
public class PermsInterceptorConfiguration implements WebMvcConfigurer {
    @Resource
    private PermsInterceptor permsInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //指定拦截器拦截所有的请求：为了方便判断的权限
        registry.addInterceptor(permsInterceptor).addPathPatterns("/**");
    }
}
